package com.example.qingyiapp.ui.activity.fragment.fragment_FrientUI;


import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.qingyiapp.R;
import com.example.qingyiapp.ui.activity.fragment.fragment_FrientUI.Adapter.Friend_fragment_adpter;
import com.example.qingyiapp.ui.activity.fragment.fragment_FrientUI.childfragment.FindFriend_chlid_fragmnet;
import com.example.qingyiapp.ui.activity.fragment.fragment_FrientUI.childfragment.Frient_child_fragment;
import com.example.qingyiapp.ui.activity.fragment.fragment_MenuUI.Childfragment.Login_child_fragment;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * A simple {@link Fragment} subclass.
 */
public class Fragment_FrientUI extends Fragment {


    Unbinder unbinder;
    @BindView(R.id.friend_tab)
    TabLayout friendTab;
    @BindView(R.id.friend_vp)
    ViewPager friendVp;

    ArrayList<String> strings = new ArrayList<>();
    ArrayList<Fragment> fragments = new ArrayList<>();

    public Fragment_FrientUI() {
        // Required empty public constructor
    }



    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_fragment__frient_ui, container, false);
        unbinder = ButterKnife.bind(this, view);
        strings.clear();
        fragments.clear();
        strings.add("结伴广场");
        strings.add("发现好友");
        strings.add("附近驿友");
        fragments.add(new Frient_child_fragment());
        fragments.add(new FindFriend_chlid_fragmnet());
        fragments.add(new Login_child_fragment());
        Friend_fragment_adpter friend_fragment_adpter = new Friend_fragment_adpter(getChildFragmentManager(), strings, fragments);
        friendVp.setAdapter(friend_fragment_adpter);
        friendTab.setupWithViewPager(friendVp);
        return view;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
